<?php
include("config.php");
mysql_connect($DBHOST, $DBUSERNAME, $DBPASSWORD);
mysql_select_db($DBNAME);
$query = mysql_query('SELECT * from Members WHERE Email =' . "'" . $_POST['Email'] . "'");
while ($row = mysql_fetch_object($query)) {
    $password = $row->Password
}
// multiple recipients
$to  = $query

// subject
$subject = 'E-Mail from Password Recovery Service';

// message
$message = '
<h2 style="text-align: center; ">
	Password Reset Service</h2>
<p>
	<strong>Hello! This is your Password Reset Email from the Pastebin you requested your password from!</strong></p>
<p>
	If you&#39;re confused, and/or think this E-mail is fake, we tell you that this is the default Password Reset E-mail for the Pastebin Members Area.</p>
<p>
	Please Note: Your password is your Identification Tool. We recommend storing it in a password safe. Try <a href="http://keepass.info">KeePass</a>.</p>
<p>
	Your password is:' . echo($password) . '</p>
<p>
	&nbsp;</p>
<p>
	<img src="http://i.imgur.com/7304e.jpg" /></p>
<p>
	Greatest Regards,</p>
<p>
	Wikked Pastebin Staff Members</p>
<p>
	&nbsp;</p>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Wikked Pastebin User' . "\r\n";
$headers .= 'From: Birthday Reminder <PasswordService@wikkedpaste.com>' . "\r\n";


// Mail it
mail($to, $subject, $message, $headers);
?>
<h2 style="text-align: center; ">
	Wikked Paste Login System Password Reset</h2>
<p>
	<strong>We see that you have came to this page because you have forgotten your password on this Pastebin. Not to worry, because we will fix that immediatly! All you have to do is fill out the following form, and you&#39;ll get your password E-Mailed to you in a jiffy!</strong></p>
<form action="forgot.php" method="post" name="Forgot Password">
	<p>
		<strong>Let&#39;s fill out this form. This will be quick and simple. Just enter the E-Mail you signed up with, then you&#39;ll get an E-Mail from us.</strong></p>
	<p>
		E-Mail Address:</p>
	<p>
		<input name="Email" type="text" /></p>
	<p>
		<strong>Now, when you submit this, you have to make sure that your E-mail is correct, or else it won&#39;t be sent to you, maybe someone else.</strong></p>
	<p style="text-align: center; ">
		<strong><input name="Submit" type="submit" value="Email me!" /></strong></p>
</form>
<p>
	&nbsp;</p>
